package com.example.daily.data.dao

import androidx.room.Dao
import androidx.room.Insert
import androidx.room.Query
import com.example.daily.data.entity.ChatMessage
import kotlinx.coroutines.flow.Flow

@Dao
interface ChatMessageDao {
    @Query("SELECT * FROM chat_messages WHERE userId = :userId ORDER BY timestamp DESC")
    fun getMessagesForUser(userId: Int): Flow<List<ChatMessage>>

    @Insert
    suspend fun insertMessage(message: ChatMessage)

    @Query("DELETE FROM chat_messages WHERE userId = :userId")
    suspend fun clearUserMessages(userId: Int)
} 